<?php


include 'vendor/autoload.php';

$container = new \League\Container\Container();

$container->share('response', Zend\Diactoros\Response::class);
$container->share('request', function () {
	return Zend\Diactoros\ServerRequestFactory::fromGlobals(
		$_SERVER, $_GET, $_POST, $_COOKIE, $_FILES
	);
});

$container->share('emitter', Zend\Diactoros\Response\SapiEmitter::class);
pdo()->getPDO();
/**
 * laravel php 5.4 ORM
 */
$manager = new \Illuminate\Database\Capsule\Manager();
$manager->setAsGlobal();
$manager->bootEloquent(); //ORM
// 微擎屏蔽了 数据库连接信息 直接强改pdo
$manager->addConnection([
	'driver'    => 'mysql',
	'host'      => 'localhost',//数据库ip host 随便填 因微擎屏蔽了 数据库的连接信息
	'database'  => 'database',
	'username'  => 'root',
	'password'  => 'password',
	'charset'   => 'utf8',
	'collation' => 'utf8_unicode_ci',
	'prefix'    => '',
]);
/**
 *  因微擎屏蔽了 数据库的连接配置信息 需要hack 一下
 */
$manager->getDatabaseManager()->extend('default', function(){
	$connection = new \Illuminate\Database\MySqlConnection(pdo()->getPDO());
	return $connection;
});

return $container;